﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Prof.Master" Inherits="System.Web.Mvc.ViewPage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="CDIO1.Controllers" %>

<script runat="server">
    int fundGoalMAX = 0;
    int highGoalMAX = 0;
    int currGoalMAX = 0;
    string sqlConnectionStr = WebConfigurationManager.ConnectionStrings["CDIO1ConnectionString"].ConnectionString;

    protected void TabContainer1_ActiveTabChanged(object sender, EventArgs e)
    {
        lbCourseID.Text = (DetailsView1.FindControl("lbID") as Label).Text;
        lbError.Visible = false;
    }
    
    protected void btnInsertRef_Click(object sender, EventArgs e)
    {
        if (txtReference.Text == "")
        {
            lbError.Text = "Reference cannot be empty!";
            lbError.Visible = true;
        } else {
            SqlDataSourceReference.InsertParameters[0].DefaultValue = lbCourseID.Text;
            SqlDataSourceReference.InsertParameters[1].DefaultValue = txtReference.Text;
            SqlDataSourceReference.Insert();
            lbError.Visible = false;
        }        
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        lbCourseID.Text = (DetailsView1.FindControl("lbID") as Label).Text;

        string query = "";
        SqlConnection cnn = new SqlConnection(sqlConnectionStr);
        //SqlCommand cmd = new SqlCommand("select count(*) from FundaGenericGoal", cnn);
        cnn.Open();
        //fundGoalMAX = (int)cmd.ExecuteScalar();
        fundGoalMAX = 10;
        SqlCommand cmd = new SqlCommand("select count(*) from HighGeneGoal", cnn);
        highGoalMAX = (int)cmd.ExecuteScalar();
        cnn.Close();
        currGoalMAX += fundGoalMAX + highGoalMAX;

        if (!IsPostBack)
        {
            // set checkboxs in fundamental generic goal
            DataView dv1 = (DataView)SqlDataSourceCourseGenGoal.Select(DataSourceSelectArguments.Empty);
            for (int i = 0; i < dv1.Table.Rows.Count; i++)
            {
                (gvFundGenGoal.Rows[(int)dv1.Table.Rows[i][2] - 1].FindControl("cbFundGenGoal") as CheckBox).Checked = true;
                (gvFundGenGoal.Rows[(int)dv1.Table.Rows[i][2] - 1].FindControl("txtFundGenGoalDesciption") as TextBox).Text = dv1.Table.Rows[i][3].ToString().Trim();
            }

            // set checkboxs in high generic goal
            DataView dv2 = (DataView)SqlDataSourceCourseHighGenGoal.Select(DataSourceSelectArguments.Empty);
            for (int i = 0; i < dv2.Table.Rows.Count; i++)
            {
                (gvHighGenGoal.Rows[(int)dv2.Table.Rows[i][2] - 1].FindControl("cbHighGenGoal") as CheckBox).Checked = true;
                (gvHighGenGoal.Rows[(int)dv2.Table.Rows[i][2] - 1].FindControl("txtHighGenGoalDescription") as TextBox).Text = dv2.Table.Rows[i][3].ToString().Trim();
            }
        }
    }

    protected void btnUpdateCourseFundGenGoal_Click(object sender, EventArgs e)
    {
        // simplest way of update, delete all and insert
        SqlDataSourceCourseGenGoal.DeleteParameters[0].DefaultValue = lbCourseID.Text;  // courseID
        SqlDataSourceCourseGenGoal.Delete();

        SqlDataSourceCourseGenGoal.InsertParameters[0].DefaultValue = lbCourseID.Text; // courseID        
        SqlDataSourceCourseGenGoal.InsertParameters[3].DefaultValue = "1";
        for (int i = 0; i < gvFundGenGoal.Rows.Count; i++)
        {
            if ((gvFundGenGoal.Rows[i].FindControl("cbFundGenGoal") as CheckBox).Checked)
            {
                SqlDataSourceCourseGenGoal.InsertParameters[1].DefaultValue =
                    (gvFundGenGoal.Rows[i].FindControl("lbFundGenGoalID") as Label).Text;
                SqlDataSourceCourseGenGoal.InsertParameters[2].DefaultValue =
                    (gvFundGenGoal.Rows[i].FindControl("txtFundGenGoalDesciption") as TextBox).Text.Trim();
                SqlDataSourceCourseGenGoal.Insert();
            }
        }
    }

    protected void btnUpdateCourseHighGenGoal_Click(object sender, EventArgs e)
    {
        // simplest way of update, delete all and insert        
        SqlDataSourceCourseHighGenGoal.DeleteParameters[0].DefaultValue = lbCourseID.Text;  // courseID
        SqlDataSourceCourseHighGenGoal.Delete();

        SqlDataSourceCourseHighGenGoal.InsertParameters[0].DefaultValue = lbCourseID.Text; // courseID        
        SqlDataSourceCourseHighGenGoal.InsertParameters[3].DefaultValue = "1";
        for (int i = 0; i < gvHighGenGoal.Rows.Count; i++)
        {
            if ((gvHighGenGoal.Rows[i].FindControl("cbHighGenGoal") as CheckBox).Checked)
            {
                SqlDataSourceCourseHighGenGoal.InsertParameters[1].DefaultValue =
                    (gvHighGenGoal.Rows[i].FindControl("lbHighGenGoalID") as Label).Text;
                SqlDataSourceCourseHighGenGoal.InsertParameters[2].DefaultValue =
                    (gvHighGenGoal.Rows[i].FindControl("txtHighGenGoalDescription") as TextBox).Text.Trim();
                SqlDataSourceCourseHighGenGoal.Insert();
            }
        }
    }

    protected void gvFundGenGoal_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int id = Int32.Parse((e.Row.FindControl("lbFundGenGoalID") as Label).Text);
            if (id == 10)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L9.1";
            }
            else if (id == 11)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L9.2";
            }
            else if (id == 12)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L9.3";
            }
            else if (id == 13)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L10";
            }
            else if (id == 14)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L10.1";
            }
            else if (id == 15)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L10.2";
            }
            else if (id == 16)
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L10.3";
            }
            else
            {
                (e.Row.FindControl("lbFundGenGoalIDFake") as Label).Text = "L" + id;
            }
        }
    }

    protected void gvHighGenGoal_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            (e.Row.FindControl("lbHighGoalIDFake") as Label).Text
                = "L" + (Int32.Parse((e.Row.FindControl("lbHighGenGoalID") as Label).Text) + fundGoalMAX);
        }
    }

    protected void btnAddLO_Click(object sender, EventArgs e)
    {
        if (txtCourseOutcomes.Text == "")
        {
            lbError.Text = "Course outcomes cannot be empty!";
            lbError.Visible = true;
            return;
        } else {
            lbError.Visible = false;
        }
        
        if (ddlFieldLO.SelectedValue == "1")
        {
            //SqlDataSourceCourseLO1.InsertParameters[0].DefaultValue = "L" + ++currGoalMAX;
            SqlDataSourceCourseLO1.InsertParameters[0].DefaultValue = lbCourseID.Text;
            SqlDataSourceCourseLO1.InsertParameters[1].DefaultValue = txtCourseOutcomes.Text.Trim();
            SqlDataSourceCourseLO1.InsertParameters[2].DefaultValue = ddlProgOutComes.SelectedValue;
            SqlDataSourceCourseLO1.Insert();
        }
        else if (ddlFieldLO.SelectedValue == "2")
        {
            //SqlDataSourceCourseLO2.InsertParameters[0].DefaultValue = "L" + ++currGoalMAX;
            SqlDataSourceCourseLO2.InsertParameters[0].DefaultValue = lbCourseID.Text;
            SqlDataSourceCourseLO2.InsertParameters[1].DefaultValue = txtCourseOutcomes.Text.Trim();
            SqlDataSourceCourseLO2.InsertParameters[2].DefaultValue = ddlProgOutComes.SelectedValue;
            SqlDataSourceCourseLO2.Insert();
        }
        else
        {
            //SqlDataSourceCourseLO3.InsertParameters[0].DefaultValue = "L" + ++currGoalMAX;
            SqlDataSourceCourseLO3.InsertParameters[0].DefaultValue = lbCourseID.Text;
            SqlDataSourceCourseLO3.InsertParameters[1].DefaultValue = txtCourseOutcomes.Text.Trim();
            SqlDataSourceCourseLO3.InsertParameters[2].DefaultValue = ddlProgOutComes.SelectedValue;
            SqlDataSourceCourseLO3.Insert();
        }
    }

    protected void btnSubmitLO_Click(object sender, EventArgs e)
    {
        SqlConnection cnn = new SqlConnection(sqlConnectionStr);
        cnn.Open();
        SqlCommand cmd = null;

        for (int i = 0; i < gvCourseLO1.Rows.Count; i++)
        {
            cmd = new SqlCommand("UPDATE [CourseLO] SET [Code] = @Code WHERE [ID] = @ID", cnn);
            cmd.Parameters.AddWithValue("@Code", "L" + ++currGoalMAX);
            cmd.Parameters.AddWithValue("@ID", (gvCourseLO1.Rows[i].FindControl("lbID") as Label).Text.Trim());
            cmd.ExecuteNonQuery();
        }
        for (int i = 0; i < gvCourseLO2.Rows.Count; i++)
        {
            cmd = new SqlCommand("UPDATE [CourseLO] SET [Code] = @Code WHERE [ID] = @ID", cnn);
            cmd.Parameters.AddWithValue("@Code", "L" + ++currGoalMAX);
            cmd.Parameters.AddWithValue("@ID", (gvCourseLO2.Rows[i].FindControl("lbID") as Label).Text.Trim());
            cmd.ExecuteNonQuery();
        }
        for (int i = 0; i < gvCourseLO3.Rows.Count; i++)
        {
            cmd = new SqlCommand("UPDATE [CourseLO] SET [Code] = @Code WHERE [ID] = @ID", cnn);
            cmd.Parameters.AddWithValue("@Code", "L" + ++currGoalMAX);
            cmd.Parameters.AddWithValue("@ID", (gvCourseLO3.Rows[i].FindControl("lbID") as Label).Text.Trim());
            cmd.ExecuteNonQuery();
        }
        cnn.Close();
        gvCourseLO1.DataBind();
        gvCourseLO2.DataBind();
        gvCourseLO3.DataBind(); 
    }

    protected void gvCourseLO1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string code = (gvCourseLO1.Rows[e.RowIndex].FindControl("lbCode") as Label).Text.Trim();
        SqlConnection cnn = new SqlConnection(sqlConnectionStr);
        cnn.Open();
        SqlCommand cmd = new SqlCommand("DELETE FROM CourseContent WHERE (CourseLOID LIKE '%' + @Code + '%')", cnn);
        cmd.Parameters.AddWithValue("@Code", "%" + code + "%");

        cmd.ExecuteNonQuery();
        cnn.Close();
    }

    protected void gvCourseLO2_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string code = (gvCourseLO2.Rows[e.RowIndex].FindControl("lbCode") as Label).Text.Trim();
        SqlConnection cnn = new SqlConnection(sqlConnectionStr);
        cnn.Open();
        SqlCommand cmd = new SqlCommand("DELETE FROM CourseContent WHERE (CourseLOID LIKE '%' + @Code + '%')", cnn);
        cmd.Parameters.AddWithValue("@Code", "%" + code + "%");

        cmd.ExecuteNonQuery();
        cnn.Close();
    }

    protected void gvCourseLO3_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string code = (gvCourseLO3.Rows[e.RowIndex].FindControl("lbCode") as Label).Text.Trim();
        SqlConnection cnn = new SqlConnection(sqlConnectionStr);
        cnn.Open();
        SqlCommand cmd = new SqlCommand("DELETE FROM CourseContent WHERE (CourseLOID LIKE '%' + @Code + '%')", cnn);
        cmd.Parameters.AddWithValue("@Code", "%" + code + "%");

        cmd.ExecuteNonQuery();
        cnn.Close();
    }

    protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
    {
        if (e.CommandName == "syllabus")
        {
            Response.Redirect("/Prof/ManageSyllabus/" + lbCourseID.Text);
        }
    }

    protected void btnExport_Click(object sender, EventArgs e)
    {
        string appPath = System.Web.HttpContext.Current.Request.ApplicationPath;
        string physicalPath = System.Web.HttpContext.Current.Request.MapPath(appPath);

        // start word and get Application object
        Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
        Microsoft.Office.Interop.Word.Document doc = null;
        //word.Visible = true;

        object filename = physicalPath + "\\CDIO.doc";
        object nullobj = System.Reflection.Missing.Value;
        doc = word.Documents.Open(ref filename, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        // using to add checkbox
        Microsoft.Office.Interop.Word.WdFieldType Type = Microsoft.Office.Interop.Word.WdFieldType.wdFieldFormCheckBox;
        Microsoft.Office.Interop.Word.Range oRange;
        Microsoft.Office.Interop.Word.FormField oFormfield;
        Microsoft.Office.Interop.Word.WdRulerStyle RulerStyle = Microsoft.Office.Interop.Word.WdRulerStyle.wdAdjustNone;
        Microsoft.Office.Interop.Word.Tables lstTable = doc.Tables;
        Microsoft.Office.Interop.Word.Row row;
        String courseCode = (DetailsView1.FindControl("lbCourseCode") as Label).Text;
        object findText = "Mã MH – Tên môn học XYZ";
        object replaceText = courseCode + " - " + (DetailsView1.FindControl("lbCourseEnglishName") as Label).Text;
        object replace = Microsoft.Office.Interop.Word.WdReplace.wdReplaceOne;
        doc.Content.Find.Execute(ref findText, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref replaceText, ref replace, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        // print Course Info
        Microsoft.Office.Interop.Word.Table tInfo = lstTable[1];
        tInfo.Rows[1].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbCourseVietnameseName") as Label).Text);
        tInfo.Rows[2].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbCourseEnglishName") as Label).Text);
        tInfo.Rows[3].Cells[2].Range.InsertAfter(courseCode);
        tInfo.Rows[4].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbBlockName") as Label).Text);
        tInfo.Rows[5].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbMajorName") as Label).Text);
        tInfo.Rows[6].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbProfName") as Label).Text);
        tInfo.Rows[7].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbOtherTeacher") as Label).Text);
        tInfo.Rows[9].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbTheoryCredit") as Label).Text);
        tInfo.Rows[10].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbPracticeCredit") as Label).Text);
        tInfo.Rows[11].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbSelfStudyCredit") as Label).Text);
        tInfo.Rows[12].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbElectiveProperty") as Label).Text);
        tInfo.Rows[13].Cells[2].Range.InsertAfter((DetailsView1.FindControl("lbRegisterCondition") as Label).Text);

        // print course objective        
        findText = "< Mô tả tóm tắt nội mục tiêu mong muốn của môn học thành một đoạn văn với font size: 12pt, line spacing: 1.5 >";
        replaceText = (DetailsView1.FindControl("lbObjective") as Label).Text;
        replace = Microsoft.Office.Interop.Word.WdReplace.wdReplaceOne;
        doc.Content.Find.Execute(ref findText, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref replaceText, ref replace, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        // print Course Fundamental Goal
        Microsoft.Office.Interop.Word.Table tFund = lstTable[2];
        object oCollapseStart = Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseStart;
        object oFont = "Wingdings";
        // set checkboxs in fundamental generic goal
        DataView dv1 = (DataView)SqlDataSourceCourseGenGoal.Select(DataSourceSelectArguments.Empty);
        for (int i = 0; i < dv1.Table.Rows.Count; i++)
        {
            oRange = tFund.Cell((int)dv1.Table.Rows[i][2] + 1, 3).Range;
            oRange.Text = "";
            oRange.Collapse(ref oCollapseStart);
            oRange.InsertSymbol(120, ref oFont, ref nullobj, ref nullobj);

            tFund.Cell((int)dv1.Table.Rows[i][2] + 1, 5).Range.Text = dv1.Table.Rows[i][3].ToString().Trim();
        }

        // print Course High Goal
        // set checkboxs in high generic goal
        Microsoft.Office.Interop.Word.Table tHigh = lstTable[3];
        DataView dv2 = (DataView)SqlDataSourceCourseHighGenGoal.Select(DataSourceSelectArguments.Empty);
        for (int i = 0; i < dv2.Table.Rows.Count; i++)
        {
            oRange = tHigh.Cell((int)dv2.Table.Rows[i][2] + 1, 3).Range;
            oRange.Text = "";
            oRange.Collapse(ref oCollapseStart);
            oRange.InsertSymbol(120, ref oFont, ref nullobj, ref nullobj);

            tHigh.Cell((int)dv2.Table.Rows[i][2] + 1, 5).Range.Text = dv2.Table.Rows[i][3].ToString().Trim();
        }

        // print Knowledge Goal
        Microsoft.Office.Interop.Word.Table tKnowledge = lstTable[5];
        DataView dvLO1 = (DataView)SqlDataSourceCourseLO1.Select(DataSourceSelectArguments.Empty);
        for (int i = 0; i < dvLO1.Table.Rows.Count; i++)
        {
            row = tKnowledge.Rows[i + 1];
            row.Cells[1].Range.Text = dvLO1.Table.Rows[i][1].ToString().Trim() + ".";
            row.Cells[2].Range.Text = dvLO1.Table.Rows[i][3].ToString().Trim();
            row.Cells[3].Range.Text = dvLO1.Table.Rows[i][7].ToString().Trim();
            tKnowledge.Rows.Add(ref nullobj);
        }

        Microsoft.Office.Interop.Word.Table tSkill = lstTable[6];
        DataView dvLO2 = (DataView)SqlDataSourceCourseLO2.Select(DataSourceSelectArguments.Empty);
        for (int i = 0; i < dvLO2.Table.Rows.Count; i++)
        {
            row = tSkill.Rows[i + 1];
            row.Cells[1].Range.Text = dvLO2.Table.Rows[i][1].ToString().Trim() + ".";
            row.Cells[2].Range.Text = dvLO2.Table.Rows[i][3].ToString().Trim();
            row.Cells[3].Range.Text = dvLO2.Table.Rows[i][7].ToString().Trim();
            tSkill.Rows.Add(ref nullobj);
        }

        Microsoft.Office.Interop.Word.Table tAttitude = lstTable[7];
        DataView dvLO3 = (DataView)SqlDataSourceCourseLO3.Select(DataSourceSelectArguments.Empty);
        for (int i = 0; i < dvLO3.Table.Rows.Count; i++)
        {
            row = tAttitude.Rows[i + 1];
            row.Cells[1].Range.Text = dvLO3.Table.Rows[i][1].ToString().Trim() + ".";
            row.Cells[2].Range.Text = dvLO3.Table.Rows[i][3].ToString().Trim();
            row.Cells[3].Range.Text = dvLO3.Table.Rows[i][7].ToString().Trim();
            tAttitude.Rows.Add(ref nullobj);
        }

        filename = physicalPath + "\\step1.doc";
        word.ActiveDocument.SaveAs(ref filename, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

        doc.Close(ref nullobj, ref nullobj, ref nullobj);
        word.Quit(ref nullobj, ref nullobj, ref nullobj);

        new AdminController().PrintSyllabus(lbCourseID.Text);

        System.String name = "CDIO_" + courseCode + ".doc";
        Response.ContentType = "application/octet-stream";
        Response.AddHeader("Content-Disposition", "Attachment; filename=" + name);
        Response.WriteFile(physicalPath + "\\output.doc");
        Response.End();
    }    
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    ManageCourse
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Button ID="btnExport" runat="server" OnClick="btnExport_Click" Text="Export" />    
            <h2>
                Manage Course
                <asp:Label ID="lbCourseID" runat="server" Text="Label" Visible="False"></asp:Label>
            </h2>
    <h2>
                <asp:Label ID="lbError" runat="server" ForeColor="Red" Text="Label" 
                    Visible="False"></asp:Label>
            </h2>
            <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="800px"
                Width="1024px" AutoPostBack="True" 
                OnActiveTabChanged="TabContainer1_ActiveTabChanged">
                <asp:TabPanel ID="TabPanelInfo" runat="server" HeaderText="Basic Information" BorderStyle="NotSet">
                    <HeaderTemplate>
                        Basic Information
                    </HeaderTemplate>
                    <ContentTemplate><asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                            CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSource1" 
                            ForeColor="#333333" GridLines="None" Height="50px" 
                            OnItemCommand="DetailsView1_ItemCommand" Width="736px"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><CommandRowStyle BackColor="#E2DED6" Font-Bold="True" /><EditRowStyle BackColor="#999999" /><FieldHeaderStyle 
                            BackColor="#E9ECF1" Font-Bold="True" Width="200px" /><Fields><asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID" 
                                    Visible="False"><EditItemTemplate><asp:Label ID="lbID" runat="server" Text='<%# Eval("ID") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbID" runat="server" Text='<%# Bind("ID") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                                HeaderText="Course Code" SortExpression="CourseCode"><EditItemTemplate><asp:TextBox ID="TextBox13" runat="server" Text='<%# Bind("CourseCode") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbCourseCode" runat="server" Text='<%# Bind("CourseCode") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Course English Name" 
                                    SortExpression="CourseEnglishName"><EditItemTemplate><asp:TextBox ID="TextBox2" runat="server" 
                                            Text='<%# Bind("CourseEnglishName") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbCourseEnglishName" runat="server" 
                                            Text='<%# Bind("CourseEnglishName") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Course Vietnamese Name" 
                                    SortExpression="CourseVietnameseName"><EditItemTemplate><asp:TextBox ID="TextBox14" runat="server" 
                                            Text='<%# Bind("CourseVietnameseName") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbCourseVietnameseName" runat="server" 
                                            Text='<%# Bind("CourseVietnameseName") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Knowledge Block" 
                                    SortExpression="KnowledgeBlockID"><EditItemTemplate><asp:DropDownList ID="DropDownList1" runat="server" 
                                            DataSourceID="SqlDataSourceBlockChoice" DataTextField="DisplayBlock" 
                                            DataValueField="ID" SelectedValue='<%# Bind("KnowledgeBlockID") %>'></asp:DropDownList><asp:SqlDataSource ID="SqlDataSourceBlockChoice" runat="server" 
                                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                                            SelectCommand="SELECT KnowledgeBlock.ID, KnowledgeBlock.Name + ' | Major: ' + Major.Name AS DisplayBlock FROM KnowledgeBlock INNER JOIN Major ON KnowledgeBlock.MajorID = Major.ID"></asp:SqlDataSource></EditItemTemplate><ItemTemplate><asp:Label ID="Label13" runat="server" Text='<%# Bind("KnowledgeBlockID") %>' 
                                            Visible="False"></asp:Label><asp:Label ID="lbBlockName" runat="server" Text='<%# Eval("BlockName") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Major In Charge" 
                                    SortExpression="MajorInChargeID"><EditItemTemplate><asp:DropDownList ID="DropDownList2" runat="server" 
                                            DataSourceID="SqlDataSourceMajorChoice" DataTextField="Name" 
                                            DataValueField="ID" SelectedValue='<%# Bind("MajorInChargeID") %>'></asp:DropDownList><asp:SqlDataSource ID="SqlDataSourceMajorChoice" runat="server" 
                                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                                            SelectCommand="SELECT [ID], [Name] FROM [Major]"></asp:SqlDataSource></EditItemTemplate><ItemTemplate><asp:Label ID="Label14" runat="server" Text='<%# Bind("MajorInChargeID") %>' 
                                            Visible="False"></asp:Label><asp:Label ID="lbMajorName" runat="server" Text='<%# Eval("MajorName") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Lecturer In Charge" 
                                    SortExpression="LecturerInChargeID"><EditItemTemplate><asp:DropDownList ID="DropDownList3" runat="server" 
                                            DataSourceID="SqlDataSourceProfChoice" DataTextField="Name" DataValueField="ID" 
                                            SelectedValue='<%# Bind("LecturerInChargeID") %>'></asp:DropDownList><asp:SqlDataSource ID="SqlDataSourceProfChoice" runat="server" 
                                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                                            SelectCommand="SELECT [ID], [Name] FROM [Professor]"></asp:SqlDataSource></EditItemTemplate><ItemTemplate><asp:Label ID="Label7" runat="server" Text='<%# Bind("LecturerInChargeID") %>' 
                                            Visible="False"></asp:Label><asp:Label ID="lbProfName" runat="server" Text='<%# Eval("ProfName") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                                HeaderText="Other Teachers" SortExpression="OtherTeacher"><EditItemTemplate><asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("OtherTeacher") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbOtherTeacher" runat="server" 
                                            Text='<%# Bind("OtherTeacher") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                                HeaderText="Theory Credit" SortExpression="TheoryCredit"><EditItemTemplate><asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("TheoryCredit") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbTheoryCredit" runat="server" 
                                            Text='<%# Bind("TheoryCredit") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                                HeaderText="Pratice Credit" SortExpression="PraticeCredit"><EditItemTemplate><asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("PraticeCredit") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbPracticeCredit" runat="server" 
                                            Text='<%# Bind("PraticeCredit") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="SelfStudy Credit" 
                                    SortExpression="SelfStudyCredit"><EditItemTemplate><asp:TextBox ID="TextBox10" runat="server" 
                                            Text='<%# Bind("SelfStudyCredit") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbSelfStudyCredit" runat="server" 
                                            Text='<%# Bind("SelfStudyCredit") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Elective Property" 
                                    SortExpression="ElectiveProperty"><EditItemTemplate><asp:TextBox ID="TextBox4" runat="server" 
                                            Text='<%# Bind("ElectiveProperty") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbElectiveProperty" runat="server" 
                                            Text='<%# Bind("ElectiveProperty") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Register Condition" 
                                    SortExpression="RegisterCondition"><EditItemTemplate><asp:TextBox ID="TextBox11" runat="server" 
                                            Text='<%# Bind("RegisterCondition") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbRegisterCondition" runat="server" 
                                            Text='<%# Bind("RegisterCondition") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Objective" SortExpression="Objective"><EditItemTemplate><asp:TextBox ID="TextBox12" runat="server" Height="90px" 
                                            Text='<%# Bind("Objective") %>' TextMode="MultiLine" Width="240px"> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="lbObjective" runat="server" Text='<%# Bind("Objective") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField ShowHeader="False"><EditItemTemplate><asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="True" 
                                            CommandName="Update" Text="Update"> </asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" 
                                            CommandName="Cancel" Text="Cancel"></asp:LinkButton></EditItemTemplate><ItemTemplate><asp:LinkButton ID="LinkButton5" runat="server" CausesValidation="False" 
                                            CommandName="Edit" Text="Edit"> </asp:LinkButton>&nbsp;<asp:LinkButton ID="lbOpenSyllabus" runat="server" CommandName="syllabus">Syllabus</asp:LinkButton></ItemTemplate></asp:TemplateField></Fields><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /></asp:DetailsView><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                            DeleteCommand="DELETE FROM [CourseInfo] WHERE [ID] = @ID" 
                            SelectCommand="SELECT CourseInfo.ID, CourseInfo.CourseCode, CourseInfo.CourseEnglishName, CourseInfo.CourseVietnameseName, CourseInfo.KnowledgeBlockID, CourseInfo.MajorInChargeID, CourseInfo.LecturerInChargeID, CourseInfo.OtherTeacher, CourseInfo.TheoryCredit, CourseInfo.PraticeCredit, CourseInfo.SelfStudyCredit, CourseInfo.RegisterCondition, CourseInfo.Objective, CourseInfo.ContentIndividualSkill, CourseInfo.ContentGroupSkill, CourseInfo.Status, KnowledgeBlock.Name AS BlockName, Major.Name AS MajorName, Professor.Name AS ProfName, CourseInfo.ElectiveProperty FROM CourseInfo INNER JOIN KnowledgeBlock ON CourseInfo.KnowledgeBlockID = KnowledgeBlock.ID INNER JOIN Major ON CourseInfo.MajorInChargeID = Major.ID AND KnowledgeBlock.MajorID = Major.ID INNER JOIN Professor ON CourseInfo.LecturerInChargeID = Professor.ID WHERE (CourseInfo.ID = @ID)" 
                            UpdateCommand="UPDATE CourseInfo SET CourseCode = @CourseCode, CourseEnglishName = @CourseEnglishName, CourseVietnameseName = @CourseVietnameseName, KnowledgeBlockID = @KnowledgeBlockID, MajorInChargeID = @MajorInChargeID, LecturerInChargeID = @LecturerInChargeID, OtherTeacher = @OtherTeacher, TheoryCredit = @TheoryCredit, PraticeCredit = @PraticeCredit, SelfStudyCredit = @SelfStudyCredit, RegisterCondition = @RegisterCondition, Objective = @Objective, ContentIndividualSkill = @ContentIndividualSkill, ContentGroupSkill = @ContentGroupSkill, ElectiveProperty = @ElectiveProperty WHERE (ID = @ID)"><DeleteParameters><asp:Parameter Name="ID" Type="Int32" /></DeleteParameters><SelectParameters><asp:QueryStringParameter Name="ID" QueryStringField="id" Type="Int32" /></SelectParameters><UpdateParameters><asp:Parameter Name="CourseCode" Type="String" /><asp:Parameter Name="CourseEnglishName" Type="String" /><asp:Parameter Name="CourseVietnameseName" Type="String" /><asp:Parameter Name="KnowledgeBlockID" Type="Int32" /><asp:Parameter Name="MajorInChargeID" Type="Int32" /><asp:Parameter Name="LecturerInChargeID" Type="Int32" /><asp:Parameter Name="OtherTeacher" Type="String" /><asp:Parameter Name="TheoryCredit" Type="Int32" /><asp:Parameter Name="PraticeCredit" Type="Int32" /><asp:Parameter Name="SelfStudyCredit" Type="Int32" /><asp:Parameter Name="RegisterCondition" Type="String" /><asp:Parameter Name="Objective" Type="String" /><asp:Parameter Name="ContentIndividualSkill" Type="String" /><asp:Parameter Name="ContentGroupSkill" Type="String" /><asp:Parameter Name="ElectiveProperty" /><asp:Parameter Name="ID" Type="Int32" /></UpdateParameters></asp:SqlDataSource>
                    </ContentTemplate>
                </asp:TabPanel>                
                <asp:TabPanel ID="TabPanelFundaGenericGoal" runat="server" HeaderText="Fundamental Generic Goals"><HeaderTemplate>
                    Fundamental Generic Goals</HeaderTemplate><ContentTemplate><asp:GridView ID="gvFundGenGoal" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                            DataSourceID="SqlDataSourceGenGoal" CellPadding="4" ForeColor="#333333" GridLines="None"
                            OnRowDataBound="gvFundGenGoal_RowDataBound"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID"><EditItemTemplate><asp:Label ID="Label8" runat="server" Text='<%# Eval("ID") %>' Visible="False"></asp:Label><asp:Label
                                            ID="Label9" runat="server" Text='<%# Eval("ID","L{0}") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbFundGenGoalID" runat="server" Text='<%# Bind("ID") %>' Visible="False"></asp:Label><asp:Label ID="lbFundGenGoalIDFake" runat="server"></asp:Label></ItemTemplate></asp:TemplateField><asp:BoundField DataField="Requirement" HeaderText="Requirement" SortExpression="Requirement" /><asp:TemplateField 
                        HeaderText="Related LO" SortExpression="RelatedLO"><EditItemTemplate><asp:TextBox 
                            ID="TextBox1" runat="server" Text='<%# Bind("RelatedLO") %>'></asp:TextBox>
                    </EditItemTemplate><ItemTemplate><asp:Label ID="lbRelatedLO" runat="server" Text='<%# Bind("RelatedLO") %>'></asp:Label>
                    </ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:CheckBox 
                            ID="cbFundGenGoal" runat="server" /></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Description"><ItemTemplate><asp:TextBox ID="txtFundGenGoalDesciption" runat="server"></asp:TextBox></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:SqlDataSource ID="SqlDataSourceGenGoal" runat="server" ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>"
                            SelectCommand="SELECT * FROM [FundaGenericGoal]"></asp:SqlDataSource><asp:SqlDataSource ID="SqlDataSourceCourseGenGoal" runat="server" ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>"
                            DeleteCommand="DELETE FROM [CourseFundaGeneGoal] WHERE [CourseID] = @CourseID"
                            InsertCommand="INSERT INTO [CourseFundaGeneGoal] ([CourseID], [FundaGeneGoalID], [Description], [Status]) VALUES (@CourseID, @FundaGeneGoalID, @Description, @Status)"
                            SelectCommand="SELECT * FROM [CourseFundaGeneGoal] WHERE [CourseID] = @CourseID"><DeleteParameters><asp:Parameter Name="CourseID" /></DeleteParameters><InsertParameters><asp:Parameter Name="CourseID" Type="Int32" /><asp:Parameter Name="FundaGeneGoalID" Type="Int32" /><asp:Parameter Name="Description" Type="String" /><asp:Parameter Name="Status" Type="Int32" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" PropertyName="Text" /></SelectParameters></asp:SqlDataSource><center><asp:Button ID="btnUpdateCourseFundGenGoal" runat="server" OnClick="btnUpdateCourseFundGenGoal_Click"
                                Text="Update" Height="26px" /></center></ContentTemplate></asp:TabPanel>
                <asp:TabPanel ID="TabPanelHighGenericGoal" runat="server" HeaderText="High Generic Goals"><HeaderTemplate>
                    High Generic Goals</HeaderTemplate><ContentTemplate><asp:GridView ID="gvHighGenGoal" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
                            DataSourceID="SqlDataSourceHighGenGoal" CellPadding="4" ForeColor="#333333" GridLines="None"
                            OnRowDataBound="gvHighGenGoal_RowDataBound"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID"><EditItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>' Visible="False"></asp:Label><asp:Label
                                            ID="Label10" runat="server" Text='<%# Bind("ID","L{0}") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbHighGenGoalID" runat="server" Text='<%# Bind("ID") %>' Visible="False"></asp:Label><asp:Label
                                            ID="lbHighGoalIDFake" runat="server"></asp:Label></ItemTemplate></asp:TemplateField><asp:BoundField DataField="Requirement" HeaderText="Requirement" SortExpression="Requirement" /><asp:TemplateField 
                        HeaderText="Related LO" SortExpression="RelatedLO"><EditItemTemplate><asp:TextBox 
                            ID="TextBox1" runat="server" Text='<%# Bind("RelatedLO") %>'></asp:TextBox>
                    </EditItemTemplate><ItemTemplate><asp:Label ID="lbRelatedLO" runat="server" Text='<%# Bind("RelatedLO") %>'></asp:Label>
                    </ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:CheckBox 
                            ID="cbHighGenGoal" runat="server" /></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Description"><ItemTemplate><asp:TextBox ID="txtHighGenGoalDescription" runat="server"></asp:TextBox></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:SqlDataSource ID="SqlDataSourceHighGenGoal" runat="server" ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>"
                            SelectCommand="SELECT * FROM [HighGeneGoal]"></asp:SqlDataSource><asp:SqlDataSource ID="SqlDataSourceCourseHighGenGoal" runat="server" ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>"
                            DeleteCommand="DELETE FROM [CourseHighGeneGoal] WHERE [CourseID] = @CourseID"
                            InsertCommand="INSERT INTO [CourseHighGeneGoal] ([CourseID], [HighGeneGoalID], [Description], [Status]) VALUES (@CourseID, @HighGeneGoalID, @Description, @Status)"
                            SelectCommand="SELECT * FROM [CourseHighGeneGoal] WHERE ([CourseID] = @CourseID)"><DeleteParameters><asp:Parameter Name="CourseID" /></DeleteParameters><InsertParameters><asp:Parameter Name="CourseID" Type="Int32" /><asp:Parameter Name="HighGeneGoalID" /><asp:Parameter Name="Description" Type="String" /><asp:Parameter Name="Status" Type="Int32" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" PropertyName="Text"
                                    Type="Int32" /></SelectParameters></asp:SqlDataSource><center><asp:Button ID="btnUpdateCourseHighGenGoal" runat="server" Height="26px" OnClick="btnUpdateCourseHighGenGoal_Click"
                                Text="Update" /></center></ContentTemplate></asp:TabPanel>
                <asp:TabPanel ID="TabPanelLO" runat="server" HeaderText="Learning Outcomes"><ContentTemplate>
                    &nbsp;<table style="width: 100%;"><tr><td style="height: 21px; width: 115px">Course 
                        Outcomes: </td><td style="height: 21px; width: 153px"><asp:TextBox ID="txtCourseOutcomes" runat="server" Width="429px"></asp:TextBox></td></tr><tr><td style="width: 115px">
                        Program Outcomes: </td><td style="width: 153px"><asp:DropDownList ID="ddlProgOutComes" runat="server" 
                                        DataSourceID="SqlDataSourceDDLProgOutComes" DataTextField="Code" 
                                        DataValueField="ID" Style="margin-left: 0px"></asp:DropDownList></td></tr><tr><td style="width: 115px">
                            Field: </td><td style="width: 153px"><asp:DropDownList ID="ddlFieldLO" runat="server" Height="17px" Width="92px"><asp:ListItem Value="1">Kiến 
                                thức</asp:ListItem><asp:ListItem Value="2">Kỹ năng</asp:ListItem><asp:ListItem Value="3">Thái 
                                độ</asp:ListItem></asp:DropDownList></td></tr></table>&nbsp;<asp:SqlDataSource ID="SqlDataSourceDDLProgOutComes" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                            SelectCommand="SELECT ProgramOutcome.ID, ProgramOutcome.ProgramID, ProgramOutcome.Code, ProgramOutcome.Description, ProgramOutcome.Status FROM (SELECT Major.ProgramID FROM Major INNER JOIN CourseInfo ON Major.ID = CourseInfo.MajorInChargeID WHERE (CourseInfo.ID = @CourseID)) AS derivedtbl_1 INNER JOIN ProgramOutcome ON derivedtbl_1.ProgramID = ProgramOutcome.ProgramID"><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" 
                                    PropertyName="Text" /></SelectParameters></asp:SqlDataSource><asp:Button ID="btnAddLO" runat="server" OnClick="btnAddLO_Click" Text="Add" /><asp:Button ID="btnSubmitLO" runat="server" OnClick="btnSubmitLO_Click" 
                            Text="Submit" /><br /><asp:Label ID="Label11" runat="server" 
                            Text="*NOTE: Click 'Submit' to submit your final Other Outcomes"></asp:Label><h1>
                        Kiến thức</h1><asp:GridView ID="gvCourseLO1" runat="server" AutoGenerateColumns="False" 
                            CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSourceCourseLO1" 
                            ForeColor="#333333" GridLines="None" OnRowDeleting="gvCourseLO1_RowDeleting" 
                            Style="margin-bottom: 0px"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID" 
                                    Visible="False"><EditItemTemplate><asp:Label ID="lbID" runat="server" 
                                    Text='<%# Eval("ID") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbID" runat="server" Text='<%# Bind("ID") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Code" SortExpression="Code"><EditItemTemplate><asp:Label ID="lbCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            HeaderText="Course Outcomes" SortExpression="CourseOutcomes"><EditItemTemplate><asp:TextBox 
                                ID="TextBox3" runat="server" Text='<%# Bind("CourseOutcomes") %>'></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label 
                                ID="Label4" runat="server" Text='<%# Bind("CourseOutcomes") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            HeaderText="Program Outcomes" SortExpression="ProgramOutComesID"><EditItemTemplate><asp:DropDownList 
                                ID="ddlProgOutComes0" runat="server" 
                                DataSourceID="SqlDataSourceDDLProgOutComes" DataTextField="Code" 
                                DataValueField="ID" SelectedValue='<%# Bind("ProgramOutComesID") %>' 
                                Style="margin-left: 0px">
                            </asp:DropDownList></EditItemTemplate><ItemTemplate><asp:Label ID="Label5" 
                                runat="server" Text='<%# Bind("ProgCode") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="GroupOutcomes" SortExpression="GroupOutcomes" 
                                    Visible="False"><ItemTemplate><asp:Label ID="Label6" runat="server" Text='<%# Bind("GroupOutcomes") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            ShowHeader="False"><EditItemTemplate><asp:LinkButton ID="LinkButton13" 
                                runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
                                &nbsp;<asp:LinkButton 
                                ID="LinkButton14" runat="server" CausesValidation="False" CommandName="Cancel" 
                                Text="Cancel"></asp:LinkButton></EditItemTemplate><ItemTemplate><asp:LinkButton 
                                ID="LinkButton15" runat="server" CausesValidation="False" CommandName="Edit" 
                                Text="Edit"></asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton16" 
                                runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:SqlDataSource ID="SqlDataSourceCourseLO1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                            DeleteCommand="DELETE FROM CourseLO WHERE (ID = @ID)" 
                            InsertCommand="INSERT INTO CourseLO(CourseID, CourseOutcomes, ProgramOutComesID, GroupOutcomes) VALUES (@CourseID, @CourseOutcomes, @ProgramOutComesID, 1)" 
                            SelectCommand="SELECT CourseLO.ID, CourseLO.Code, CourseLO.CourseID, CourseLO.CourseOutcomes, CourseLO.ProgramOutComesID, CourseLO.GroupOutcomes, CourseLO.Status, ProgramOutcome.Code AS ProgCode FROM CourseLO INNER JOIN ProgramOutcome ON CourseLO.ProgramOutComesID = ProgramOutcome.ID WHERE (CourseLO.CourseID = @CourseID) AND (CourseLO.GroupOutcomes = @GroupOutcomes)" 
                            UpdateCommand="UPDATE [CourseLO] SET [Code] = @Code, [CourseOutcomes] = @CourseOutcomes, [ProgramOutComesID] = @ProgramOutComesID WHERE [ID] = @ID"><DeleteParameters><asp:Parameter Name="ID" /></DeleteParameters><InsertParameters><asp:Parameter Name="CourseID" Type="Int32" /><asp:Parameter Name="CourseOutcomes" Type="String" /><asp:Parameter Name="ProgramOutComesID" Type="Int32" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" 
                                    PropertyName="Text" Type="Int32" /><asp:Parameter DefaultValue="1" Name="GroupOutcomes" Type="Int32" /></SelectParameters><UpdateParameters><asp:Parameter Name="Code" Type="String" /><asp:Parameter Name="CourseOutcomes" Type="String" /><asp:Parameter Name="ProgramOutComesID" Type="Int32" /><asp:Parameter Name="ID" Type="Int32" /></UpdateParameters></asp:SqlDataSource><h1>
                    Kỹ năng</h1><asp:GridView ID="gvCourseLO2" runat="server" AutoGenerateColumns="False" 
                            CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSourceCourseLO2" 
                            ForeColor="#333333" GridLines="None"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID" 
                                    Visible="False"><EditItemTemplate><asp:Label ID="lbID" runat="server" Text='<%# Eval("ID") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbID" runat="server" Text='<%# Bind("ID") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Code" SortExpression="Code"><EditItemTemplate><asp:Label ID="lbCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:BoundField DataField="CourseID" HeaderText="CourseID" 
                                    SortExpression="CourseID" Visible="False" /><asp:TemplateField 
                            HeaderText="Course Outcomes" SortExpression="CourseOutcomes"><EditItemTemplate><asp:TextBox 
                                ID="TextBox15" runat="server" Text='<%# Bind("CourseOutcomes") %>'></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label 
                                ID="Label21" runat="server" Text='<%# Bind("CourseOutcomes") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            HeaderText="Program Outcomes" SortExpression="ProgramOutComesID"><EditItemTemplate><asp:DropDownList 
                                ID="ddlProgOutComes1" runat="server" 
                                DataSourceID="SqlDataSourceDDLProgOutComes" DataTextField="Code" 
                                DataValueField="ID" SelectedValue='<%# Bind("ProgramOutComesID") %>' 
                                Style="margin-left: 0px">
                            </asp:DropDownList></EditItemTemplate><ItemTemplate><asp:Label ID="Label22" 
                                runat="server" Text='<%# Bind("ProgCode") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            ShowHeader="False"><EditItemTemplate><asp:LinkButton ID="LinkButton17" 
                                runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton 
                                ID="LinkButton6" runat="server" CausesValidation="False" CommandName="Cancel" 
                                Text="Cancel"></asp:LinkButton></EditItemTemplate><ItemTemplate><asp:LinkButton 
                                ID="LinkButton7" runat="server" CausesValidation="False" CommandName="Edit" 
                                Text="Edit"></asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton8" 
                                runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:SqlDataSource ID="SqlDataSourceCourseLO2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                            DeleteCommand="DELETE FROM CourseLO WHERE (ID = @ID)" 
                            InsertCommand="INSERT INTO CourseLO(CourseID, CourseOutcomes, ProgramOutComesID, GroupOutcomes) VALUES (@CourseID, @CourseOutcomes, @ProgramOutComesID, 2)" 
                            SelectCommand="SELECT CourseLO.ID, CourseLO.Code, CourseLO.CourseID, CourseLO.CourseOutcomes, CourseLO.ProgramOutComesID, CourseLO.GroupOutcomes, CourseLO.Status, ProgramOutcome.Code AS ProgCode FROM CourseLO INNER JOIN ProgramOutcome ON CourseLO.ProgramOutComesID = ProgramOutcome.ID WHERE (CourseLO.CourseID = @CourseID) AND (CourseLO.GroupOutcomes = @GroupOutcomes)" 
                            UpdateCommand="UPDATE [CourseLO] SET [Code] = @Code, [CourseOutcomes] = @CourseOutcomes, [ProgramOutComesID] = @ProgramOutComesID WHERE [ID] = @ID"><DeleteParameters><asp:Parameter Name="ID" Type="Int32" /></DeleteParameters><InsertParameters><asp:Parameter Name="CourseID" Type="Int32" /><asp:Parameter Name="CourseOutcomes" Type="String" /><asp:Parameter Name="ProgramOutComesID" Type="Int32" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" 
                                    PropertyName="Text" Type="Int32" /><asp:Parameter DefaultValue="2" Name="GroupOutcomes" Type="Int32" /></SelectParameters><UpdateParameters><asp:Parameter Name="Code" Type="String" /><asp:Parameter Name="CourseOutcomes" Type="String" /><asp:Parameter Name="ProgramOutComesID" Type="Int32" /><asp:Parameter Name="ID" Type="Int32" /></UpdateParameters></asp:SqlDataSource><h1>
                    Thái độ</h1><asp:GridView ID="gvCourseLO3" runat="server" AutoGenerateColumns="False" 
                            CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSourceCourseLO3" 
                            ForeColor="#333333" GridLines="None" OnRowDeleting="gvCourseLO3_RowDeleting"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID" 
                                    Visible="False"><EditItemTemplate><asp:Label ID="lbID" runat="server" 
                                    Text='<%# Eval("ID") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbID" runat="server" Text='<%# Bind("ID") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Code" SortExpression="Code"><EditItemTemplate><asp:Label ID="lbCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="lbCode" runat="server" Text='<%# Bind("Code") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            HeaderText="Course Outcomes" SortExpression="CourseOutcomes"><EditItemTemplate><asp:TextBox 
                                ID="TextBox16" runat="server" Text='<%# Bind("CourseOutcomes") %>'></asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label 
                                ID="Label16" runat="server" Text='<%# Bind("CourseOutcomes") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="GroupOutcomes" SortExpression="GroupOutcomes" 
                                    Visible="False"><EditItemTemplate><asp:Label ID="Label17" runat="server" Text='<%# Bind("GroupOutcomes") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="Label18" runat="server" Text='<%# Bind("GroupOutcomes") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Program Outcomes" 
                                    SortExpression="ProgramOutComesID"><EditItemTemplate><asp:DropDownList ID="ddlProgOutComes2" runat="server" 
                                            DataSourceID="SqlDataSourceDDLProgOutComes" DataTextField="Code" 
                                            DataValueField="ID" SelectedValue='<%# Bind("ProgramOutComesID") %>' 
                                            Style="margin-left: 0px"></asp:DropDownList></EditItemTemplate><ItemTemplate><asp:Label ID="Label19" runat="server" Text='<%# Bind("ProgCode") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField 
                            ShowHeader="False"><EditItemTemplate><asp:LinkButton ID="LinkButton9" 
                                runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
                                &nbsp;<asp:LinkButton 
                                ID="LinkButton10" runat="server" CausesValidation="False" CommandName="Cancel" 
                                Text="Cancel"></asp:LinkButton></EditItemTemplate><ItemTemplate><asp:LinkButton 
                                ID="LinkButton11" runat="server" CausesValidation="False" CommandName="Edit" 
                                Text="Edit"></asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton12" 
                                runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:SqlDataSource ID="SqlDataSourceCourseLO3" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>" 
                            DeleteCommand="DELETE FROM [CourseLO] WHERE [ID] = @ID" 
                            InsertCommand="INSERT INTO CourseLO(CourseID, CourseOutcomes, ProgramOutComesID, GroupOutcomes) VALUES (@CourseID, @CourseOutcomes, @ProgramOutComesID, 3)" 
                            SelectCommand="SELECT CourseLO.ID, CourseLO.Code, CourseLO.CourseID, CourseLO.CourseOutcomes, CourseLO.ProgramOutComesID, CourseLO.GroupOutcomes, CourseLO.Status, ProgramOutcome.Code AS ProgCode FROM CourseLO INNER JOIN ProgramOutcome ON CourseLO.ProgramOutComesID = ProgramOutcome.ID WHERE (CourseLO.CourseID = @CourseID) AND (CourseLO.GroupOutcomes = @GroupOutcomes)" 
                            UpdateCommand="UPDATE [CourseLO] SET [Code] = @Code, [CourseOutcomes] = @CourseOutcomes, [ProgramOutComesID] = @ProgramOutComesID WHERE [ID] = @ID"><DeleteParameters><asp:Parameter Name="ID" Type="Int32" /></DeleteParameters><InsertParameters><asp:Parameter Name="CourseID" Type="Int32" /><asp:Parameter Name="CourseOutcomes" Type="String" /><asp:Parameter Name="ProgramOutComesID" Type="Int32" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" 
                                    PropertyName="Text" Type="Int32" /><asp:Parameter DefaultValue="3" Name="GroupOutcomes" Type="Int32" /></SelectParameters><UpdateParameters><asp:Parameter Name="Code" Type="String" /><asp:Parameter Name="CourseOutcomes" Type="String" /><asp:Parameter Name="ProgramOutComesID" Type="Int32" /><asp:Parameter Name="ID" Type="Int32" /></UpdateParameters></asp:SqlDataSource></ContentTemplate></asp:TabPanel>
                <asp:TabPanel ID="TabPanelReference" runat="server" HeaderText="Reference"><ContentTemplate><asp:GridView ID="gvReference" runat="server" AutoGenerateColumns="False" CellPadding="4"
                            DataKeyNames="ID" DataSourceID="SqlDataSourceReference" 
                        ForeColor="#333333" GridLines="None"
                            AllowPaging="True" Style="margin-top: 0px"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:TemplateField HeaderText="CourseID" SortExpression="CourseID" Visible="False"><EditItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("CourseID") %>'></asp:Label></EditItemTemplate><ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("CourseID") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Reference" SortExpression="Reference"><EditItemTemplate><asp:TextBox ID="txtReference" runat="server" Text='<%# Bind("Reference") %>'> </asp:TextBox></EditItemTemplate><ItemTemplate><asp:Label ID="Label2" runat="server" Text='<%# Bind("Reference") %>'> </asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField ShowHeader="False"><EditItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                                            Text="Update"> </asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton2" runat="server"
                                                CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton></EditItemTemplate><ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                                            Text="Edit"> </asp:LinkButton>&nbsp;<asp:LinkButton ID="LinkButton2" runat="server"
                                                CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /></asp:GridView><asp:TextBox ID="txtReference" runat="server"></asp:TextBox><asp:Button ID="btnInsertRef" runat="server" onclick="btnInsertRef_Click" 
                        Text="Add" /><asp:SqlDataSource ID="SqlDataSourceReference" runat="server" ConnectionString="<%$ ConnectionStrings:CDIO1ConnectionString %>"
                            SelectCommand="SELECT * FROM [CourseReference] WHERE ([CourseID] = @CourseID)"
                            UpdateCommand="UPDATE [CourseReference] SET [Reference] = @Reference WHERE [ID] = @ID"
                            DeleteCommand="DELETE FROM [CourseReference] WHERE [ID] = @ID" InsertCommand="INSERT INTO [CourseReference] ([CourseID], [Reference], [Status]) VALUES (@CourseID, @Reference, 1)"><DeleteParameters><asp:Parameter Name="ID" Type="Int32" /></DeleteParameters><InsertParameters><asp:Parameter Name="CourseID" Type="Int32" /><asp:Parameter Name="Reference" Type="String" /></InsertParameters><SelectParameters><asp:ControlParameter ControlID="lbCourseID" Name="CourseID" PropertyName="Text" /></SelectParameters><UpdateParameters><asp:Parameter Name="Reference" Type="String" /><asp:Parameter Name="ID" Type="Int32" /></UpdateParameters></asp:SqlDataSource></ContentTemplate></asp:TabPanel>
            </asp:TabContainer>
       
</asp:Content>
